package com.minimalist.common.entity.basic.po;

import com.mybatisflex.annotation.Table;

import java.io.Serial;
import java.io.Serializable;

/**
 * 用户与岗位关联表 1用户-N岗位 实体类。
 *
 * @author 小太阳
 * @since 2024-10-18
 */
@Table(value = "m_user_post")
public class MUserPost implements Serializable{

    public MUserPost() {
    }

    public MUserPost(Long userId, Long postId) {
        this.userId = userId;
        this.postId = postId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getPostId() {
        return postId;
    }

    public void setPostId(Long postId) {
        this.postId = postId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MUserPost mUserPost = (MUserPost) o;
        if (userId != null ? !userId.equals(mUserPost.userId) : mUserPost.userId != null) return false;
        return postId != null ? postId.equals(mUserPost.postId) : mUserPost.postId == null;
    }

    @Override
    public int hashCode() {
        int result = userId != null ? userId.hashCode() : 0;
        result = 31 * result + (postId != null ? postId.hashCode() : 0);
        return result;
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private Long userId;
        private Long postId;

        Builder() {
        }

        public Builder userId(Long userId) {
            this.userId = userId;
            return this;
        }

        public Builder postId(Long postId) {
            this.postId = postId;
            return this;
        }

        public MUserPost build() {
            return new MUserPost(userId, postId);
        }
    }

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 岗位ID
     */
    private Long postId;

}
